gtk4.git
5 years agogl renderer: Fix render node texture cache
Alexander Larsson [Wed, 30 Sep 2020 12:53:13 +0000 (14:53 +0200)]
gl renderer: Fix render node texture cache

We're caching two things, either a node itself being rendered, or a
parent storing a cached version of a child as rendered to an offscreen
the size and location of the parent.

If both the parent and child uses the cache this will cause a conflict in
the cache as it is currently use keying of a node pointer which will have
the same value for the node-as-itself and the child-node-of-the-parent.

We fix this by adding another part to the key "pointer_is_child" which means
we can have the same node pointer twice in the cache.

Additionally, in the child-is-rendered-offscreen case the offscreen
result actually depends on the position and size of the parent viewport,
so we need to store the parent bounds in that case.

5 years agogtk-demo: Make gltransitions demo a bit snazzier
Alexander Larsson [Wed, 30 Sep 2020 09:40:37 +0000 (11:40 +0200)]
gtk-demo: Make gltransitions demo a bit snazzier

This adds a bunch of snazz to the gltransitions demo. It is perhaps
a bit overloaded now, but it demos everything that we can do.

Changes:
 * The fire shader is now not a bin, it just renders an animating
   background with no textures involved.
 * The stacks don't all start on the same page.
 * The shaderbin passes the mouse coordinate to the shader.
 * The shaderbin allows specifying a "border" so that you can
   cause effects outside the bin child (something that is new to gtk4).
 * All the buttons and the stacks are now in shader-bins that runs
   a wobbly-widget effect based on the mouse position that
   wobbles outside the child allocation.

5 years agoMerge branch 'small-cleanup' into 'master'
Matthias Clasen [Tue, 29 Sep 2020 21:52:37 +0000 (21:52 +0000)]
Merge branch 'small-cleanup' into 'master'

menubutton: Remove obsolete private method

See merge request GNOME/gtk!2643

5 years agoMerge branch 'ebassi/for-master' into 'master'
Matthias Clasen [Tue, 29 Sep 2020 20:45:00 +0000 (20:45 +0000)]
Merge branch 'ebassi/for-master' into 'master'

Ebassi/for master

See merge request GNOME/gtk!2642

5 years agorelease script: Fix doc tarball generation
Matthias Clasen [Tue, 29 Sep 2020 19:07:13 +0000 (15:07 -0400)]
release script: Fix doc tarball generation

Strip one level from the directories.

5 years agomenubutton: Remove obsolete private method
Florian Müllner [Tue, 29 Sep 2020 18:46:18 +0000 (20:46 +0200)]
menubutton: Remove obsolete private method

It was only added for the fallback app menu in headerbars, which
has been removed in the meantime.

5 years agoAdd annotations for GtkBuildable virtual functions
Emmanuele Bassi [Tue, 29 Sep 2020 18:48:55 +0000 (19:48 +0100)]
Add annotations for GtkBuildable virtual functions

Now that the functions that wrap them have gone away from the public
API, we need proper annotations for the virtual functions, otherwise
languages will not have enough information on nullable arguments and
ownership transfer.

5 years ago3.99.2
Matthias Clasen [Tue, 29 Sep 2020 12:55:08 +0000 (08:55 -0400)]
3.99.2

5 years agogsk: Add some more shader docs
Matthias Clasen [Tue, 29 Sep 2020 15:32:03 +0000 (11:32 -0400)]
gsk: Add some more shader docs

Do a pass over the docs and address minor inconsistencies,
cosmetics and formatting differences.

Mention GSK_DEBUG=shaders.

5 years agoMerge branch 'snapshot-stack-optimize' into 'master'
Matthias Clasen [Tue, 29 Sep 2020 18:44:07 +0000 (18:44 +0000)]
Merge branch 'snapshot-stack-optimize' into 'master'

Minor optimizations to GtkSnapshot state stack

See merge request GNOME/gtk!2641

5 years agoRemove gtk-doc stanzas from private GtkBuildable API
Emmanuele Bassi [Tue, 29 Sep 2020 18:39:34 +0000 (19:39 +0100)]
Remove gtk-doc stanzas from private GtkBuildable API

Various functions were moved to the private GtkBuildable header by
commit 2715b3ec31256ee1c3e0276fdc0154cd8a69fa8e, but the functions still
have gtk-doc stanzas.

5 years agosnapshot: Preallocate and don't memset the state stack
Alexander Larsson [Tue, 29 Sep 2020 14:03:06 +0000 (16:03 +0200)]
snapshot: Preallocate and don't memset the state stack

Most of the time the snapshot is less than 16 levels deep (did some testing
in gtk-demo), so lets pre-allocate 16 levels of state stack to avoid the
extra allocation most of the time.

5 years agogdkarray: Add support for GDK_ARRAY_NO_MEMSET
Alexander Larsson [Tue, 29 Sep 2020 14:00:30 +0000 (16:00 +0200)]
gdkarray: Add support for GDK_ARRAY_NO_MEMSET

If all your callers already initialize the array element as needed,
then we don't need to memset it to zero first.

This is pretty useful for the snapshot state stack, because due
to the per-node-type data area the elements on the stack are
quite large, but often a lot of it is not used.

5 years agogdkarray: Inline splice and reserve
Alexander Larsson [Tue, 29 Sep 2020 13:57:33 +0000 (15:57 +0200)]
gdkarray: Inline splice and reserve

This inlines the splice and reserver GdkArray calls. These are
typically only called from the gdk_array_(append/set_size) functions
anyway, and inlining the caller means we can constant propagate the
constant arguments in those calls. Its hard to get exact numbers, but
in fishbowl i noticed a significant decrease in the time spent in
the array code when pushing and poping states.

5 years agoMerge branch 'matthiasc/for-master' into 'master'
Matthias Clasen [Tue, 29 Sep 2020 12:57:36 +0000 (12:57 +0000)]
Merge branch 'matthiasc/for-master' into 'master'

Matthiasc/for master

See merge request GNOME/gtk!2639

5 years agoMerge branch 'glshader-track-uniform-state' into 'master'
Matthias Clasen [Tue, 29 Sep 2020 12:49:22 +0000 (12:49 +0000)]
Merge branch 'glshader-track-uniform-state' into 'master'

gl: Track the current uniform state for custom programs

See merge request GNOME/gtk!2638

5 years agodocs: Document various entry ::activate signals
Matthias Clasen [Tue, 29 Sep 2020 02:52:35 +0000 (22:52 -0400)]
docs: Document various entry ::activate signals

5 years agostatusbar: Remove a misleading doc comment
Matthias Clasen [Tue, 29 Sep 2020 02:43:42 +0000 (22:43 -0400)]
statusbar: Remove a misleading doc comment

5 years agosnapshot: Document radial gradient apis
Matthias Clasen [Tue, 29 Sep 2020 02:43:27 +0000 (22:43 -0400)]
snapshot: Document radial gradient apis

5 years agodocs: Fix a typo
Matthias Clasen [Tue, 29 Sep 2020 02:43:17 +0000 (22:43 -0400)]
docs: Fix a typo

5 years agowayland: Match header and doc arguments
Matthias Clasen [Tue, 29 Sep 2020 02:28:09 +0000 (22:28 -0400)]
wayland: Match header and doc arguments

gtk-doc doesn't take this lightly.

5 years agogsk: Document radial gradient api
Matthias Clasen [Tue, 29 Sep 2020 02:24:59 +0000 (22:24 -0400)]
gsk: Document radial gradient api

5 years agoSilence a compiler warning
Matthias Clasen [Tue, 29 Sep 2020 02:12:31 +0000 (22:12 -0400)]
Silence a compiler warning

These variables are not used anymore since
commit 11e4a4696713bc.

5 years agoNEWS: Updates
Matthias Clasen [Tue, 29 Sep 2020 11:03:02 +0000 (07:03 -0400)]
NEWS: Updates

5 years agogl: Track the current uniform state for custom programs
Alexander Larsson [Tue, 29 Sep 2020 09:52:39 +0000 (11:52 +0200)]
gl: Track the current uniform state for custom programs

This allows us to avoid updating uniforms if that is not necessary. This
in turn allows us to sometimes reuse the same draw op by just extending the
vertex array size we draw rather than doing a separate glDraw call.

For example, in the fishbowl demo, all the icons added at the same
time will have the same time and size, so we emit single draw calls
with 100s of triangles instead of 100s of draw calls with 2 triangles.

5 years agoMerge branch 'glshader-node' into 'master'
Alexander Larsson [Tue, 29 Sep 2020 08:30:48 +0000 (08:30 +0000)]
Merge branch 'glshader-node' into 'master'

Add support for GLShader nodes

See merge request GNOME/gtk!2594

5 years agoAdd some shader tests
Matthias Clasen [Wed, 23 Sep 2020 22:05:57 +0000 (18:05 -0400)]
Add some shader tests

These are just basic api usage tests, no rendering.
They found the issues fixed in the preceding commits.

5 years agogtk-demo: Add a shader paintable to the fishbowl
Alexander Larsson [Tue, 29 Sep 2020 07:36:10 +0000 (09:36 +0200)]
gtk-demo: Add a shader paintable to the fishbowl

This gets around 500 instances at 60fps on my system.

5 years agogtk-demo: Add GskGLShaderNode demo
Alexander Larsson [Mon, 21 Sep 2020 19:05:04 +0000 (21:05 +0200)]
gtk-demo: Add GskGLShaderNode demo

Add adds a demo showing off GskGLShaderNode in various ways.

It has a transistion widget, using some examples from
gl-transitions.com, with child widgets being both images, a GL area
and real widgets (that let you edit the transition shaders
themselves.

It also has a fancy fire effect on hove on the buttons.

5 years agoSupport GLShaderNode in backends
Alexander Larsson [Fri, 18 Sep 2020 16:03:30 +0000 (18:03 +0200)]
Support GLShaderNode in backends

For vulkan/broadway this just means to ignore it, but for the gl
backend we support (with up to 4 texture inputs, which is similar to
what shadertoy does, so should be widely supported).

5 years agoGtkSnapshot: Add gtk_snapshot_push_glshader()
Alexander Larsson [Fri, 18 Sep 2020 15:56:02 +0000 (17:56 +0200)]
GtkSnapshot: Add gtk_snapshot_push_glshader()

5 years agoAdd GskGLShaderNode and GskGLShader
Alexander Larsson [Fri, 18 Sep 2020 15:46:57 +0000 (17:46 +0200)]
Add GskGLShaderNode and GskGLShader

A GskGLShader is an abstraction of a GLSL fragment shader that
can produce pixel values given inputs:
 * N (currently max 4) textures
 * Current arguments for the shader uniform
Uniform types are: float,(u)int,bool,vec234)
There is also a builder for the uniform arguments which are
passed around as immutable GBytes in the built form.

A GskGLShaderNode is a render node that renders a GskGLShader inside a
specified rectangular bounds. It renders its child nodes as textures
and passes those as texture arguments to the shader. You also pass it
a uniform arguments object.

5 years agogsk: Add more shader debug spew
Matthias Clasen [Wed, 23 Sep 2020 20:17:56 +0000 (16:17 -0400)]
gsk: Add more shader debug spew

Print out the full assembled shader sources when
GSK_DEBUG=shaders is given. This is very verbose,
but may be useful to see what we actually pass
to the compiler.

5 years agoGtkWindow: Create renderer before realizing child widgets
Alexander Larsson [Mon, 28 Sep 2020 18:47:32 +0000 (20:47 +0200)]
GtkWindow: Create renderer before realizing child widgets

This way the child widgets can rely on the renderer (for example what
type it is) to decide details about how they render (such as if they
should use OpenGL shaders).

5 years agocss: Move the last parser api to the new header
Matthias Clasen [Mon, 28 Sep 2020 17:09:54 +0000 (13:09 -0400)]
css: Move the last parser api to the new header

This lets us use it from the render node parser
in gsk.

5 years agoshadertoy demo: Fix GLSL on GLES
Alexander Larsson [Wed, 23 Sep 2020 15:38:03 +0000 (17:38 +0200)]
shadertoy demo: Fix GLSL on GLES

I was getting "assignment to varying fragColor" errors

5 years agogl: Add some namespacing to the preamble symbols
Alexander Larsson [Fri, 18 Sep 2020 09:35:29 +0000 (11:35 +0200)]
gl: Add some namespacing to the preamble symbols

This adds a gsk prefix to the stuff in the preamble, as we want to
avoid it conflicting with things in the main shader. Especially once
we start allow some customization of shaders.

5 years agogl backend: Add line numbers to source in glsl compilation errors
Alexander Larsson [Mon, 21 Sep 2020 13:14:40 +0000 (15:14 +0200)]
gl backend: Add line numbers to source in glsl compilation errors

Almost always the source is created by combining various sources, which
means the line numbers in the error messages are hard to use. Adding
the line numbers to the source in the error message helps with this.

5 years agogl: Properly report error if shader linking fails
Alexander Larsson [Fri, 18 Sep 2020 09:34:14 +0000 (11:34 +0200)]
gl: Properly report error if shader linking fails

In gsk_gl_shader_builder_create_program(), if linking fails we
need to return -1 to indicate error, rather than the old deleted
program id.

5 years agoglrenderer: Move ProgramState into Program
Alexander Larsson [Fri, 18 Sep 2020 07:15:03 +0000 (09:15 +0200)]
glrenderer: Move ProgramState into Program

There is no real reason to have this on the side indexed via the
index, as it is stored next to each other anyway. Plus, storing them
together lets use use `Program` structures not in the array.

5 years agoMerge branch 'arnaudb/menubutton-direction' into 'master'
Matthias Clasen [Tue, 29 Sep 2020 01:55:24 +0000 (01:55 +0000)]
Merge branch 'arnaudb/menubutton-direction' into 'master'

Make GtkMenuButton::direction more useful.

Closes #2811

See merge request GNOME/gtk!2636

5 years agoMerge branch 'matthiasc/for-master' into 'master'
Matthias Clasen [Tue, 29 Sep 2020 01:53:02 +0000 (01:53 +0000)]
Merge branch 'matthiasc/for-master' into 'master'

Matthiasc/for master

Closes #3202

See merge request GNOME/gtk!2637

5 years agoAdd a reftest for flipping transforms
Matthias Clasen [Tue, 29 Sep 2020 00:32:27 +0000 (20:32 -0400)]
Add a reftest for flipping transforms

Verify that a scale of -1 does in fact cause a
gradient to go the other direction.

5 years agotextbuffer: Elaborate docs
Matthias Clasen [Sun, 27 Sep 2020 15:24:18 +0000 (11:24 -0400)]
textbuffer: Elaborate docs

Explain a bit more what gtk_text_buffer_get_content_provider()
is for.

Fixes: #3202
5 years agowindow: Don't get surfaces needlessly
Matthias Clasen [Sun, 27 Sep 2020 12:57:05 +0000 (08:57 -0400)]
window: Don't get surfaces needlessly

There is a 1-1 correspondence between natives and
surfaces, so we can just compare the natives, no
need to get the surface for every single one.

5 years agodoc: Document some apis as widget implementor only
Matthias Clasen [Sun, 27 Sep 2020 03:33:39 +0000 (23:33 -0400)]
doc: Document some apis as widget implementor only

A better solution for this would be nice. For the
time being, just add a sentence to the docs.

5 years agoMake GtkMenuButton::direction more useful.
Arnaud Bonatti [Mon, 28 Sep 2020 15:30:30 +0000 (17:30 +0200)]
Make GtkMenuButton::direction more useful.

This property was only used until now when
there was neither an icon nor a label set,
for arrow direction and popover placement.

Starting with Gtk4, a GtkMenuButton with a
label shows an arrow at the right (in LTR)
of the label. Allow disabling the arrow or
changing its direction using the direction
property, to have a way to restore a Gtk3-
like look or to improve popover placement.

Fixes #2811.

5 years agoMerge branch 'wip/carlosg/for-master' into 'master'
Matthias Clasen [Mon, 28 Sep 2020 22:03:36 +0000 (22:03 +0000)]
Merge branch 'wip/carlosg/for-master' into 'master'

gtkeventcontrollerscroll: Drop device type checks

Closes #3210

See merge request GNOME/gtk!2635

5 years agogtkeventcontrollerscroll: Drop device type checks
Carlos Garnacho [Mon, 28 Sep 2020 21:30:05 +0000 (23:30 +0200)]
gtkeventcontrollerscroll: Drop device type checks

Kinetic scrolling (and begin/end tracking) broke with commit cab1dcb696
since the pointing device used on X11 does not get as much GdkInputSource
granularity as the source device used to have in GTK3.

Actually this is kinda pointless, devices incapable of smooth scroll
should send discrete events, without those devices in the picture, we
want kinetic scroll to apply on every other device capable of smooth
scroll, so just do that.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3210
5 years agoUpdate Hebrew translation
Yosef Or Boczko [Mon, 28 Sep 2020 19:00:12 +0000 (19:00 +0000)]
Update Hebrew translation

(cherry picked from commit f6e3dfd73ef7f319d0827052854f5e26b4a2dcd0)

5 years agoUpdate Hebrew translation
Yosef Or Boczko [Mon, 28 Sep 2020 18:58:52 +0000 (18:58 +0000)]
Update Hebrew translation

(cherry picked from commit 02d1d9714ed07d1712d6f0e9c386e475f83ad986)

5 years agoMerge branch 'another-attempt-to-fix-shadertoy' into 'master'
Matthias Clasen [Mon, 28 Sep 2020 16:16:51 +0000 (16:16 +0000)]
Merge branch 'another-attempt-to-fix-shadertoy' into 'master'

Flip GLArea textures

See merge request GNOME/gtk!2634

5 years agoMerge branch 'cloudproviders-ci' into 'master'
Matthias Clasen [Mon, 28 Sep 2020 15:45:08 +0000 (15:45 +0000)]
Merge branch 'cloudproviders-ci' into 'master'

Cloudproviders ci

Closes #2480

See merge request GNOME/gtk!2632

5 years agoMerge branch 'wip/otte/for-master' into 'master'
Matthias Clasen [Mon, 28 Sep 2020 15:43:02 +0000 (15:43 +0000)]
Merge branch 'wip/otte/for-master' into 'master'

snapshot: Don't flip textures

See merge request GNOME/gtk!2633

5 years agoglarea: Flip our texture
Matthias Clasen [Sun, 27 Sep 2020 16:33:13 +0000 (12:33 -0400)]
glarea: Flip our texture

The texture that produce is upside-down, compared to what
GSK expects, so flip things around with a transform.

This fixes the shadertoy demo being upside-down after a
recent fix to avoid downloading and reuploading the texture.

5 years agogsk: Normalize when transforming bounds
Matthias Clasen [Mon, 28 Sep 2020 15:23:51 +0000 (11:23 -0400)]
gsk: Normalize when transforming bounds

Bounds are assumed to be normalized, and transforms
with negative scales or 3d rotations can make us get
negative sizes.

Fix by Benjamin Otte.

5 years agosnapshot: Don't flip textures
Benjamin Otte [Mon, 28 Sep 2020 14:09:06 +0000 (16:09 +0200)]
snapshot: Don't flip textures

... or gradients or borders or shadows. Instead, ensure that affines
have non-negative scale factors. Otherwise add a transform node.

The only place where this check is not necessary is color nodes, but
special casing them seems not worth it.

5 years agoUpdate Italian translation
Milo Casagrande [Mon, 28 Sep 2020 07:41:47 +0000 (07:41 +0000)]
Update Italian translation

5 years agoUpdated Lithuanian translation
Aurimas Černius [Sun, 27 Sep 2020 19:06:30 +0000 (22:06 +0300)]
Updated Lithuanian translation

5 years agoci: Use v23 images
Matthias Clasen [Sun, 27 Sep 2020 15:47:19 +0000 (11:47 -0400)]
ci: Use v23 images

I added libcloudproviders to the base image, but
now I see that we already enabled libcloudproviders
in the build anyway, so I'm a bit confused.

Fixes: #2480
5 years agoci: Add libcloudproviders to the image
Matthias Clasen [Sun, 27 Sep 2020 15:28:25 +0000 (11:28 -0400)]
ci: Add libcloudproviders to the image

Add libcloudproviders to fedora-base:v23 and fedora:v23.
This is so we can enable the cloud-providers feature in
our ci builds.

5 years agoMerge branch 'patch-1' into 'master'
Matthias Clasen [Sun, 27 Sep 2020 15:03:04 +0000 (15:03 +0000)]
Merge branch 'patch-1' into 'master'

treestore: Document the fact that iter is modified by the function, in a machine-readable fashion.

See merge request GNOME/gtk!2613

5 years agoUpdate gtktreestore.c: gtk_tree_store_remove didn't have the proper comment annotation
Danny Milosavljevic [Sun, 27 Sep 2020 15:03:03 +0000 (15:03 +0000)]
Update gtktreestore.c: gtk_tree_store_remove didn't have the proper comment annotation
"inout" for the parameter ITER passed.  This means that bindings would misjudge what
the function does.  In the case of guile-gi, it would be misjudged for a predicate,
see gulie-gi bug 87.

5 years agoMerge branch 'issue2627-gtk4' into 'master'
Matthias Clasen [Sun, 27 Sep 2020 14:51:23 +0000 (14:51 +0000)]
Merge branch 'issue2627-gtk4' into 'master'

gdk/wayland: Replace gtk-primary-selection with primary-selection-unstable-v1

See merge request GNOME/gtk!2630

5 years agoMerge branch 'avoid-gl-texture-download' into 'master'
Matthias Clasen [Sun, 27 Sep 2020 14:47:52 +0000 (14:47 +0000)]
Merge branch 'avoid-gl-texture-download' into 'master'

gsk: Avoid downloading GL textures when possible

See merge request GNOME/gtk!2628

5 years agogdk/wayland: Replace gtk-primary-selection with primary-selection-unstable-v1
Robert Mader [Sun, 27 Sep 2020 14:10:52 +0000 (16:10 +0200)]
gdk/wayland: Replace gtk-primary-selection with primary-selection-unstable-v1

The later is the public upstream version, while identical implementation wise.

https://gitlab.gnome.org/GNOME/gtk/-/issues/2591

5 years agoMerge branch 'fontchooser-no-lang' into 'master'
Matthias Clasen [Sun, 27 Sep 2020 12:42:42 +0000 (12:42 +0000)]
Merge branch 'fontchooser-no-lang' into 'master'

fontchooser: Fix builds without PangoFT2

See merge request GNOME/gtk!2629

5 years agogsk: Avoid downloading GL textures when possible
Matthias Clasen [Sun, 27 Sep 2020 01:55:28 +0000 (21:55 -0400)]
gsk: Avoid downloading GL textures when possible

I found that the gears demo was spending 40% cpu
downloading a GL texture every frame, only to
upload it again to another context.

While the GSK rendering and the GtkGLArea use different
GL contexts, they are (usually) connected by sharing data
with the same global context, so we can just use the
texture without the download/upload dance. This brings
gears down to < 10% cpu.

5 years agofontchooser: Fix builds without PangoFT2
Matthias Clasen [Thu, 24 Sep 2020 09:37:32 +0000 (17:37 +0800)]
fontchooser: Fix builds without PangoFT2

Currently, only if PangoFT2 is present and used it is supported
to retrieve the languages that are supported by a particular font.

If we don't have PangoFT2, remove the language filtering and the
sample text selection.

Based on earlier work by Chun-wei Fan, see
https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/2614

5 years agoMerge branch 'BUG_gtktreeview_headers_focus_on_click_GTK4' into 'master'
Matthias Clasen [Sat, 26 Sep 2020 22:50:23 +0000 (22:50 +0000)]
Merge branch 'BUG_gtktreeview_headers_focus_on_click_GTK4' into 'master'

GtkTreeviewColumn: don't focus-on-click header buttons

See merge request GNOME/gtk!1806

5 years agotestupload: Test more formats
Matthias Clasen [Sat, 26 Sep 2020 21:26:12 +0000 (17:26 -0400)]
testupload: Test more formats

Copy the format conversion code from GdkMemoryTexture
so we can produce all formats, and test them all.

The upload fast paths assume that the stride is a
multiple of four, so some of the padding values cause
it to fail. Apart from that, things seem to work for
all combinations.

5 years agoMerge branch 'matthiasc/for-master' into 'master'
Matthias Clasen [Sat, 26 Sep 2020 14:00:32 +0000 (14:00 +0000)]
Merge branch 'matthiasc/for-master' into 'master'

Matthiasc/for master

See merge request GNOME/gtk!2626

5 years agoAdd a test for various texture uploads
Matthias Clasen [Sat, 26 Sep 2020 03:02:19 +0000 (23:02 -0400)]
Add a test for various texture uploads

Create textures with various characteristics (alpha, premultiplication,
stride) that trigger different code paths in the gl texture upload
function, and show the resulting images. If all goes well, they all
should look the same.

On my system, this tests texture upload for memory formats
GDK_MEMORY_B8G8R8A8_PREMULTIPLIED, GDK_MEMORY_R8G8B8A8, and
GDK_MEMORY_R8G8B8, and it works with both gl and gles.

5 years agoNEWS: Updates
Matthias Clasen [Sat, 26 Sep 2020 01:27:25 +0000 (21:27 -0400)]
NEWS: Updates

5 years agoMerge branch 'fix-texture-upload-more' into 'master'
Matthias Clasen [Sat, 26 Sep 2020 12:52:25 +0000 (12:52 +0000)]
Merge branch 'fix-texture-upload-more' into 'master'

More texture upload fixes

Closes #3198

See merge request GNOME/gtk!2624

5 years agoMerge branch 'matthiasc/for-master' into 'master'
Matthias Clasen [Sat, 26 Sep 2020 02:02:13 +0000 (02:02 +0000)]
Merge branch 'matthiasc/for-master' into 'master'

gl: Make debug spew more complete

Closes #3197

See merge request GNOME/gtk!2623

5 years agoMore texture upload fixes
Matthias Clasen [Sat, 26 Sep 2020 01:59:33 +0000 (21:59 -0400)]
More texture upload fixes

In some cases, with bpp == 3 and a rowstride
that is divisible by 4, we were passing invalid
parameters to GL.

Fixes: #3198
5 years agoMerge branch 'add-child-clash' into 'master'
Matthias Clasen [Sat, 26 Sep 2020 01:17:08 +0000 (01:17 +0000)]
Merge branch 'add-child-clash' into 'master'

Make GtkBuildable vfunc accessor functions private

Closes #3191

See merge request GNOME/gtk!2619

5 years agopopup: Fix up a doc blurb
Matthias Clasen [Sat, 26 Sep 2020 00:43:01 +0000 (20:43 -0400)]
popup: Fix up a doc blurb

The GdkPopup:autohide property was mis-documented.

Fixes: #3197
5 years agogl: Make debug spew more complete
Matthias Clasen [Fri, 25 Sep 2020 19:52:15 +0000 (15:52 -0400)]
gl: Make debug spew more complete

List GL_EXT_unpack_subimage among the extensions
we check for.

5 years agoMerge branch 'fix-rgb-upload' into 'master'
Matthias Clasen [Sat, 26 Sep 2020 00:30:31 +0000 (00:30 +0000)]
Merge branch 'fix-rgb-upload' into 'master'

gl: Fix RGB uploads

Closes #3194

See merge request GNOME/gtk!2620

5 years agodocs: Document GtkBuildable changes in migration guide
Florian Müllner [Fri, 25 Sep 2020 20:54:52 +0000 (22:54 +0200)]
docs: Document GtkBuildable changes in migration guide

https://gitlab.gnome.org/GNOME/gtk/-/issues/3191

5 years agobuildable: Make vfunc accessor functions private
Florian Müllner [Fri, 25 Sep 2020 12:27:26 +0000 (14:27 +0200)]
buildable: Make vfunc accessor functions private

With the exception of gtk_buildable_get_id(), those are only used
to construct objects from XML descriptions, which is functionality
internal to GTK.

The API is therefore unlikely to be missed, and keeping it internal
means they can no longer unintentionally shadow object methods in
bindings with less namespacing; for example it's currently ambiguous
whether `infoBar.add_child()` refers to gtk_info_bar_add_child() or
gtk_buildable_add_child().

https://gitlab.gnome.org/GNOME/gtk/-/issues/3191

5 years agobuildable: Rename set_name() to set_buildable_id()
Florian Müllner [Fri, 25 Sep 2020 14:43:24 +0000 (16:43 +0200)]
buildable: Rename set_name() to set_buildable_id()

GtkBuildable's get_name()/set_name() methods may shadow
GtkWidget's methods. Avoid that by renaming the API to
get_buildable_id()/set_buildable_id(), which also reflects
the name of the XML attribute the API refers to.

https://gitlab.gnome.org/GNOME/gtk/-/issues/3191

5 years agogl: Reset GL_UNPACK_ALIGNMENT
Matthias Clasen [Fri, 25 Sep 2020 20:17:45 +0000 (16:17 -0400)]
gl: Reset GL_UNPACK_ALIGNMENT

Reset GL_UNPACK_ALIGNMENT to its initial value of 4 after
changing it for a glTexImage2D call.

5 years agoMerge branch 'matthiasc/for-master' into 'master'
Matthias Clasen [Fri, 25 Sep 2020 18:25:09 +0000 (18:25 +0000)]
Merge branch 'matthiasc/for-master' into 'master'

columnview: Simplify column constructors

See merge request GNOME/gtk!2622

5 years agocolumnview: Simplify column constructors
Matthias Clasen [Fri, 25 Sep 2020 17:53:42 +0000 (13:53 -0400)]
columnview: Simplify column constructors

Drop gtk_column_view_column_new_with_factory and
just make gtk_column_view_column_new accept a
nullable factory. This follows what we've been
doing elsewhere.

Update all callers.

5 years agoMerge branch 'wip/carlosg/for-master' into 'master'
Matthias Clasen [Fri, 25 Sep 2020 17:49:59 +0000 (17:49 +0000)]
Merge branch 'wip/carlosg/for-master' into 'master'

Wip/carlosg/for master

Closes #3125 and #3121

See merge request GNOME/gtk!2621

5 years agogtkbutton: Clean up priv->in_button
Carlos Garnacho [Fri, 25 Sep 2020 17:15:29 +0000 (19:15 +0200)]
gtkbutton: Clean up priv->in_button

This is now only toggled around, may be cleaned up.

5 years agogtkbutton: Check release coordinates on all release event types
Carlos Garnacho [Fri, 25 Sep 2020 17:10:46 +0000 (19:10 +0200)]
gtkbutton: Check release coordinates on all release event types

The priv->in_button state that used to be relied upon for pointer
events has been reduced over time to a broken state, since the button
does not track crossing events anymore.

Make the coordinate-based checks apply for pointer events too, besides
touch events. This fixes GtkButton mistakenly emitting ::clicked with
pointer button releases outside the widget.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3121
5 years agogl: Fix RGB uploads
Matthias Clasen [Fri, 25 Sep 2020 17:15:54 +0000 (13:15 -0400)]
gl: Fix RGB uploads

I don't really know what to say, other than:
OpenGL is terrible

Fixes: #3194
5 years agogtktextview: Avoid GtkGestureClick claiming on touch press
Carlos Garnacho [Fri, 25 Sep 2020 15:50:04 +0000 (17:50 +0200)]
gtktextview: Avoid GtkGestureClick claiming on touch press

We still want the drag gesture (and text selection) to work. Avoid claiming
the gesture early, like it's done in the pointer case.

5 years agogtkscrolledwindow: Do not eagerly claim touch press event
Carlos Garnacho [Fri, 25 Sep 2020 15:47:26 +0000 (17:47 +0200)]
gtkscrolledwindow: Do not eagerly claim touch press event

Claiming early makes the contents unable to react to the touch press
event. Do this on GtkGestureDrag::update past a threshold, so the
child widget(s) can claim before the scrolledwindow does.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3125
5 years agogtkscrolledwindow: Drop gtk_scrolled_window_set_capture_button_press()
Carlos Garnacho [Fri, 25 Sep 2020 15:23:00 +0000 (17:23 +0200)]
gtkscrolledwindow: Drop gtk_scrolled_window_set_capture_button_press()

This API is kinda stuck in the GdkEvent days, we now negotiate ownership
of the input sequence via GtkGestures. Remove it as it reflects a way to
work that was not exactly accurate and it will turn plainly wrong soon.

5 years agoMerge branch 'gles-texture-colors' into 'master'
Matthias Clasen [Fri, 25 Sep 2020 14:53:19 +0000 (14:53 +0000)]
Merge branch 'gles-texture-colors' into 'master'

Fix uploads of textures in GLES (and make texture uploads better)

See merge request GNOME/gtk!2616

5 years agoMerge branch 'wip/baedert/for-master' into 'master'
Timm Bäder [Fri, 25 Sep 2020 13:35:20 +0000 (13:35 +0000)]
Merge branch 'wip/baedert/for-master' into 'master'

Wip/baedert/for master

See merge request GNOME/gtk!2617

5 years agoDrop gdk_cairo_surface_upload_to_gl() helper
Alexander Larsson [Fri, 25 Sep 2020 08:08:21 +0000 (10:08 +0200)]
Drop gdk_cairo_surface_upload_to_gl() helper

There is nothing really special about this code, its just a helper for
uploading pixel data to opengl, and we're not really in the business
of doing opengl-specific helper functions.

5 years agogl backend: Avoid roundtripping via surface when updloading
Alexander Larsson [Thu, 24 Sep 2020 14:58:46 +0000 (16:58 +0200)]
gl backend: Avoid roundtripping via surface when updloading

Do custom uploads rather than using gdk_cairo_surface_upload_to_gl(),
because this way we avoids a roundtrip (memcpy and possibly conversion)
to the cairo image surface format.

5 years agogdk_gl_context_upload_texture() avoid conversion for pixbuf format
Alexander Larsson [Thu, 24 Sep 2020 15:01:04 +0000 (17:01 +0200)]
gdk_gl_context_upload_texture() avoid conversion for pixbuf format

The gdk-pixbuf non-rgba format can be directly uploaded without
conversion.

The rgba format needs alpha premultiplication though, which is not
supported by GL during upload.

5 years agoCorrectly upload textures for GLES
Alexander Larsson [Thu, 24 Sep 2020 13:03:48 +0000 (15:03 +0200)]
Correctly upload textures for GLES

GLES doesn't support the GL_BGRA +  GL_UNSIGNED_INT_24_8 hack that
we use on desktop OpenGL to upload textures directly in the cairo
pixel format. This adds the required conversions to all the places
that currently need it.

We also add a data_format to the internal gdk_gl_context_upload_texture()
function to make it clearer what the format are. Currently it is always
the cairo image surface format, but eventually we want to support other
formats so that we can avoid some of the unnecessary conversions we do.

Also, the current gdk_gl_context_upload_texture() code always converts
to a cairo format and uploads that like we did before. Later commits
will allow this to use other upload formats that gl supports to avoid
conversions.